package cn.kogee.service.impl;

import cn.kogee.domian.Product;
import cn.kogee.domian.Store;
import cn.kogee.mapper.ProductMapper;
import cn.kogee.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class ProductServiceImpl implements IProductService {
    @Autowired
    private ProductMapper productMapper;
    @Override
    public void add(Product product) {
        productMapper.save(product);
    }

    @Override
    public Product findById(Long id) {
        return productMapper.loadById(id);
    }

    @Override
    public Product findByNameorPrice(String name, BigDecimal price) {
        return productMapper.loadByNameOrPrice(name,price);
    }

    /*return productMapper.loadByNameOrPrice(product);*/

}
